
/*******************************************************
*  Team name: FTPMP
*  Class involve: Player, Role, MagicTool
*  Version: 1.0 
*  Author: Ada Ko
*  History of modification:
*  Ver 1.0, Fred,
*  -add Player constructor
*  
*  Ver 1.1, Fred,
*  -add getSE, getPID, getOrder
*  
*******************************************************/


package entity;
import java.awt.*;
import javax.swing.*;
import entity.MagicTool;
import entity.Role;
import java.util.Vector;

public class Player 
{ 
    private int SE=0;  
    private int PID; 
	private int order;
	private int bonus;
	private Role role;
	private Vector<MagicTool> magicTool;
    // Default Constructor
	public Player()
	{
		this.PID=0;
        this.bonus=1;
        magicTool=new Vector<MagicTool>();
	}
    public Player(int PID) 
    { 
        this.PID=PID;
        this.bonus=1;
        magicTool=new Vector<MagicTool>();
    }
 
    //Conversion  Constructor
    public Player(Role role)
    {
        this.role = role; 
    }
	public int getBonus()
	{
		return this.bonus;
	}
	public void updateBonus(int bonus)
	{
		this.bonus=bonus;
	}
	//GET Function
	public int getSE() 
	{
        return SE;
    }
   
    public int getPID() {
        return PID;
    }
	
	public int getOrder() {
		return order;
    }
    
    public Role getRole() {
        return role;
    }
    
    public Vector<MagicTool> getMagicTool() 
    {
        return magicTool;
    }
	
	//SET Function
    public void setSE(int SE) {
        this.SE = SE;
    }
    
    public void setPID(int PID) {
        this.PID = PID;
    }
	
	public void setOrder(int order) {
        this.order = order;
    }
    
    public void setRole(Role role) {
        this.role = role;
    }
    
    public void addMagicTool(MagicTool magicTool) 
    {
        this.magicTool.add(magicTool);
    }
    public void removeMagicTool(int MTID) 
    {
        this.magicTool.removeElementAt(MTID);
        System.out.println("At Player- MT to be removed: "+MTID);
    	System.out.println("At Player- MT Card No: "+this.magicTool.size());
    }
	
	//Other Function
	
	public String getRoleType()
	{
		return role.getRoleType();
	}
	// SE: decrease by negative no
	public void updatePlayerSE(int SE)
	{
		this.SE+=SE;
	
	}
	//Get the number of toolcards
	public int getMagicToolNum() 
	{
      return magicTool.size();
	}

	public String getMTInfo(int MTID) 
	{	
		return this.magicTool.get(MTID).getInfo();
	}
	public void setBonus(int bonus) 
	{
		this.bonus=bonus;
	}

}  